Hi All
Grateful for any clues here please.
I have a script which has two include statements at the top, and when this script runs interactively it is fine.
However when I try and run in batch via a command line - e.g. it fails
"c:\Program Files\telelogic\DOORS_8.3\bin\doors.exe" -u donald.duck -b "\\network drive\Audit.dxl" -data 39999@ABCDED exit_()
I get messages come up about undeclared variables. variables which are used in the include but declared in the main script - the function that uses the variables is in the included file.
Any help much appreciated thanks.
Roobroo - Mon Oct 04 08:53:48 EDT 2010 |
|
Re: Include files and Batch Mode Runnin SystemAdmin - Tue Oct 05 02:46:49 EDT 2010
In a similar kind of problems (works in DOORS client / does not work in batch mode) the solution often has been to add braces {} around the main program.
|
|
Re: Include files and Batch Mode Runnin Roobroo - Tue Oct 05 04:00:04 EDT 2010 SystemAdmin - Tue Oct 05 02:46:49 EDT 2010
In a similar kind of problems (works in DOORS client / does not work in batch mode) the solution often has been to add braces {} around the main program.
Thank you for replying Pekka.
Unfortunately I already have braces around the whole script thanks, as I have solved problems before by doing this.
|
|
Re: Include files and Batch Mode Runnin Mathias Mamsch - Tue Oct 05 06:23:07 EDT 2010
Hmm hard to say what the real problem is, without looking at the code and the error messages. I would suggest the following for starters:
-
Disable Autodeclare in the script. Run again in interactive mode and check if this is the problem.
-
It could be the case that the batch run has a different environment than the interactive session. So change all includes to absolute paths, to make sure, that the right files are used.
-
See if in an interactive Session the variables are declared on global level, by just entering their name in the DXL Editor Window. If the undeclared variable names are functions you will get "incorrect arguments", if they are variables and a declared you will get no error.
-
Or alternate: Try running the includes without the main program in interactive mode
-
Make sure that in the main program the variables are declared on top level, meaning not inside any braces.
If you post the code or a part of it that reproduces the error, this would be really helpful for solving the issue.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Include files and Batch Mode Runnin Roobroo - Tue Oct 05 06:50:12 EDT 2010 Mathias Mamsch - Tue Oct 05 06:23:07 EDT 2010
Hmm hard to say what the real problem is, without looking at the code and the error messages. I would suggest the following for starters:
-
Disable Autodeclare in the script. Run again in interactive mode and check if this is the problem.
-
It could be the case that the batch run has a different environment than the interactive session. So change all includes to absolute paths, to make sure, that the right files are used.
-
See if in an interactive Session the variables are declared on global level, by just entering their name in the DXL Editor Window. If the undeclared variable names are functions you will get "incorrect arguments", if they are variables and a declared you will get no error.
-
Or alternate: Try running the includes without the main program in interactive mode
-
Make sure that in the main program the variables are declared on top level, meaning not inside any braces.
If you post the code or a part of it that reproduces the error, this would be really helpful for solving the issue.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Hi Mathias
Thank you for the detailed helped.
I have to admit that you have lost me a little on a couple of points -
-
How do I disable autodeclare please?
-
"See if in an interactive Session the variables are declared on global level, by just entering their name in the DXL Editor Window" - could you explain a bit more about this please?
-
I have the whole script wrapped in braces, should I move the braces so that they do not contain the variables?
Many thanks again
|
|
Re: Include files and Batch Mode Runnin Roobroo - Tue Oct 05 07:09:42 EDT 2010 Roobroo - Tue Oct 05 06:50:12 EDT 2010
Hi Mathias
Thank you for the detailed helped.
I have to admit that you have lost me a little on a couple of points -
-
How do I disable autodeclare please?
-
"See if in an interactive Session the variables are declared on global level, by just entering their name in the DXL Editor Window" - could you explain a bit more about this please?
-
I have the whole script wrapped in braces, should I move the braces so that they do not contain the variables?
Many thanks again
I jumped in with the auto-declare question without looking up myself - sorry about that. Having looked at this, its not really an option for me, as it will impact a lot of people unfortunately.
Thanks though.
|
|
Re: Include files and Batch Mode Runnin Mathias Mamsch - Tue Oct 05 09:06:16 EDT 2010 Roobroo - Tue Oct 05 06:50:12 EDT 2010
Hi Mathias
Thank you for the detailed helped.
I have to admit that you have lost me a little on a couple of points -
-
How do I disable autodeclare please?
-
"See if in an interactive Session the variables are declared on global level, by just entering their name in the DXL Editor Window" - could you explain a bit more about this please?
-
I have the whole script wrapped in braces, should I move the braces so that they do not contain the variables?
Many thanks again
Hi I think we will move a lot quicker on this if you at least post a code example. Can you do the following, just to give an idea of the code structure. Take the first "undeclared variable" message that you get in batch mode, note the variable or function name.
Then search your scripts and give me a general idea of the code structure, so make sure relevant braces are included. Example:
// main.dxl
// ...
int myUndeclaredGlobalVar = 4;
// ...
for x in y do {
#include <../includes/someLib.inc>
// ...
someFuncOfSomeLib()
}
// ----------------- someLib.inc --------------
// ...
void someFuncOfSomeLib () {
// ...
print myUndeclaredGlobalVar // boom: undeclared variable error message, only in batch mode
}
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Include files and Batch Mode Runnin llandale - Wed Oct 06 16:51:30 EDT 2010
Don't think you need the "exit_()" at the end of you batch statement, but perhaps you do in your DXL file, perhaps "if (batchmode()) exit_()". My batch programs end just fine without it, but I suppose some other folks know more about that than I do.
You are saying that when you open DOORS normally and load and run file \\network drive\Audit.dxl fro the DXL window, it works? Does it work when you run your command line in normal mode, changing "-b" to "-d" (no batch mode)?
Is it possible the error occurs when you use system defined variables? If so, the following from my old notes may be useful, where you need to specifically include certain standard include files when in Batch mode. Otherwise you may need to post your code, but if you send it I can no doubt debug it.
// batchStartup: #include <libdxlver.inc>
// #include <standard/access/accessData.inc>
// perm functions in DXL
// #include <standard/help/codes.inc>
// #include <utils/continue.inc>
// batchStartup: #include <utils/matches.dxl>
// batchStartup: #include <utils/attrutil.inc>
// batchStartup: #include <utils/unique.dxl>
// batchStartup: #include <utils/general.inc>
// batchStartup: #include <utils/autorun.inc>
// #include <utils/tabUtils.inc>
// #include <utils/moduleDB.inc>
// #include <standard/options/globalSettings.inc>
// #include <project/globals.inc>
// #include <utils/attrui.inc>
#include <standard/column/storedGlobals.inc> // ValidateAttrValue_() (used by cps stuff below
// #include <utils/dialogDefaults.inc>
// #include <standard/dbSearch/globals.inc>
// #include <standard/search/findreplace.inc>
// #include <standard/filter/globals.inc>
// batchStartup: #include <utils/fileops.dxl>
#include <standard/cps/cps_common_globals.inc>
#include <standard/cps/cps_common_attrdbe.inc>
#include <standard/cps/cps_common_utils.inc> // fnGetSourcePath(), fnGetCPModulePath()
// #include <standard/cps/cps_maps.inc>
// #include <standard/suspect/common_globals.inc>
// #include <standard/suspect/common_utils.inc>
// #include <config/folderUtils.inc>
// #include <config/dbExplorerGlobals.inc>
// batchStartup: #include <utils/iutil.inc>
// void toBeDone(string todo){
// // infoBox "To be done: " todo
// }
// void toBeDone(){
// //infoBox "Not implemented yet."
// }
// #include <standard/access/accessTab.inc>
// #include <standard/databaseProperties/properties.dxl>
// #include <standard/attribute/attribute.dxl>
// #include <standard/object/properties.dxl>
// #include <standard/insert/picture/inc/storedGlobals.inc>
// #include <standard/itemProperties/properties.dxl>
// #include <config/mappingFns.inc>
// #include <standard/unlock/unlock.dxl>
// #include <config/helpmenu.inc>
// #include <config/ExplorerNavigation.inc>
// #include <config/baseWindowSetup.inc>
// #include <standard/archive/archiveRestore.dxl>
// #include <standard/spelling/spelling.dxl>
// #include <standard/views/views.dxl>
// #include <standard/fns/fnsGlobals.dxl>
// #include <standard/pageSetup/pageSetupGlobals.inc>
// #include <standard/baseline/signatures.inc>
// #include <standard/testTracking/T3_startup.dxl>
// #include <config/menuFns.inc>
// bool objectPropertiesRealized = false
// bool objectPropertiesShowing = false
|
|